package A14;

public class Product {
    private String title; // 商品名称
    private double weight; // 商品重量（单位：kg）
    private String description; // 商品描述
    private double unitPrice; // 商品单价（单位：元）

    public Product(String title, double weight, String description, double unitPrice) {
        this.title = title;
        this.weight = weight;
        this.description = description;
        this.unitPrice = unitPrice;
    }

    // 根据数量获取总价
    public double getPriceForQuantity(int quantity) {
        return unitPrice * quantity;
    }

    // 获取商品重量
    public double getWeight() {
        return weight;
    }

    // getter/setter
    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }
}